// @ts-ignore
/* eslint-disable */
import { request } from 'umi';

/** 获取后台工作分页列表 POST /api/crontab/${param0}/${param1}/paged-list */
export async function postApiCrontabByIndexByLimitPagedList(
  params: {
    // query
    /** 开始时间 */
    StartTime?: string;
    /** 结束时间 */
    EndTime?: string;
    // path
    index: number;
    limit: number;
  },
  body: API.CrontabSort,
  options?: { [key: string]: any },
) {
  const { index: param0, limit: param1, ...queryParams } = params;
  return request<API.SimpleResultPagingListCrontabDto>(
    `/api/crontab/${param0}/${param1}/paged-list`,
    {
      method: 'POST',
      headers: {
        'Content-Type': 'application/json-patch+json',
      },
      params: {
        ...queryParams,
      },
      data: body,
      ...(options || {}),
    },
  );
}

/** 获取后台工作详情 GET /api/crontab/detail/${param0} */
export async function getApiCrontabDetailById(
  params: {
    // path
    id: string;
  },
  options?: { [key: string]: any },
) {
  const { id: param0, ...queryParams } = params;
  return request<API.SimpleResultCrontabDetailDto>(`/api/crontab/detail/${param0}`, {
    method: 'GET',
    params: { ...queryParams },
    ...(options || {}),
  });
}

/** 创建任务 POST /api/crontab */
export async function postApiCrontab(body: API.InputCrontabDto, options?: { [key: string]: any }) {
  return request<any>('/api/crontab', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json-patch+json',
    },
    data: body,
    ...(options || {}),
  });
}

/** 删除任务 DELETE /api/crontab */
export async function deleteApiCrontab(body: string[], options?: { [key: string]: any }) {
  return request<any>('/api/crontab', {
    method: 'DELETE',
    headers: {
      'Content-Type': 'application/json-patch+json',
    },
    data: body,
    ...(options || {}),
  });
}

/** 更新任务 PUT /api/crontab/${param0} */
export async function putApiCrontabById(
  params: {
    // path
    id: string;
  },
  body: API.InputCrontabDto,
  options?: { [key: string]: any },
) {
  const { id: param0, ...queryParams } = params;
  return request<any>(`/api/crontab/${param0}`, {
    method: 'PUT',
    headers: {
      'Content-Type': 'application/json-patch+json',
    },
    params: { ...queryParams },
    data: body,
    ...(options || {}),
  });
}

/** 检查实例是否可用 GET /api/crontab/check-instance */
export async function getApiCrontabCheckInstance(
  params: {
    // query
    path?: string;
    id?: string;
  },
  options?: { [key: string]: any },
) {
  return request<any>('/api/crontab/check-instance', {
    method: 'GET',
    params: {
      ...params,
    },
    ...(options || {}),
  });
}

/** 获取后台工作定义列表 GET /api/crontab/definitions */
export async function getApiCrontabDefinitions(options?: { [key: string]: any }) {
  return request<API.SimpleResultListEnumOptionDto>('/api/crontab/definitions', {
    method: 'GET',
    ...(options || {}),
  });
}

/** 获取任务的执行记录 GET /api/crontab/${param0}/${param1}/execute-records */
export async function getApiCrontabByIndexByLimitExecuteRecords(
  params: {
    // query
    id?: string;
    // path
    index: number;
    limit: number;
  },
  options?: { [key: string]: any },
) {
  const { index: param0, limit: param1, ...queryParams } = params;
  return request<API.SimpleResultPagingListCrontabExecuteRecordDto>(
    `/api/crontab/${param0}/${param1}/execute-records`,
    {
      method: 'GET',
      params: {
        ...queryParams,
      },
      ...(options || {}),
    },
  );
}

/** 运行任务 GET /api/crontab/${param0}/start */
export async function getApiCrontabByIdStart(
  params: {
    // path
    id: string;
  },
  options?: { [key: string]: any },
) {
  const { id: param0, ...queryParams } = params;
  return request<any>(`/api/crontab/${param0}/start`, {
    method: 'GET',
    params: { ...queryParams },
    ...(options || {}),
  });
}

/** 停止任务 GET /api/crontab/${param0}/stop */
export async function getApiCrontabByIdStop(
  params: {
    // path
    id: string;
  },
  options?: { [key: string]: any },
) {
  const { id: param0, ...queryParams } = params;
  return request<any>(`/api/crontab/${param0}/stop`, {
    method: 'GET',
    params: { ...queryParams },
    ...(options || {}),
  });
}
